package com.itheima.reggie.controller;


import com.itheima.reggie.common.ResultInfo;
import com.itheima.reggie.domain.Dish;
import com.itheima.reggie.domain.SetMeal;
import com.itheima.reggie.domain.SetMealDish;
import com.itheima.reggie.service.SetMealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SetMealController {

    @Autowired
    private SetMealService setMealService;

    /*查询套餐列表*/
    @GetMapping("/setmeal/list")
    public ResultInfo findList(@RequestParam("categoryId") Long id,Integer status){
        List<SetMeal> list = setMealService.findList(id,status);
        return ResultInfo.success(list);
    }


    /*app端套餐菜品*/
    @GetMapping("/setmeal/dish/{id}")
    public ResultInfo setMealDish(@PathVariable("id")Long id){

        List<SetMealDish> dishes =  setMealService.findDishesById(id);
        return ResultInfo.success(dishes);
    }

}
